/*
 * PersonSearchOptions.java
 */

package nxtgeninventorysystem.Data;

/**
 * The PersonSearchOptions class is meant to hold data that will determine
 * which attributes will be filtered in person searches.
 * @author Seraph Softworks
 */
public class PersonSearchOptions extends Data {

    private boolean consider_id;
    private boolean consider_name;
    private boolean consider_team;
    private boolean consider_contact_no;

    /**
     * @return the consider_id
     */
    public boolean considerId() {
        return consider_id;
    }

    /**
     * @param consider_id the consider_id to set
     */
    public void setConsiderId(boolean consider_id) {
        this.consider_id = consider_id;
    }

    /**
     * @return the consider_name
     */
    public boolean considerName() {
        return consider_name;
    }

    /**
     * @param consider_name the consider_name to set
     */
    public void setConsiderName(boolean consider_name) {
        this.consider_name = consider_name;
    }

    /**
     * @return the consider_team
     */
    public boolean considerTeam() {
        return consider_team;
    }

    /**
     * @param consider_team the consider_team to set
     */
    public void setConsiderTeam(boolean consider_team) {
        this.consider_team = consider_team;
    }

    /**
     * @return the consider_contact_no
     */
    public boolean considerContactNo() {
        return consider_contact_no;
    }

    /**
     * @param consider_contact_no the consider_contact_no to set
     */
    public void setConsiderContactNo(boolean consider_contact_no) {
        this.consider_contact_no = consider_contact_no;
    }

    @Override
    public void reset() {
        setConsiderContactNo(false);
        setConsiderId(false);
        setConsiderName(false);
        setConsiderTeam(false);
    }

    public String getPersonOrderString() {
        String order = "";
        if (consider_contact_no)
            order += " order by contact_no ";
        else if (consider_id)
            order += " order by id ";
        else if (consider_name)
            order += " order by name ";
        else if (consider_team)
            order += " order by team ";
        return order;
    }

    public boolean personOrderSpecified() {
        return consider_id ^ consider_team ^ consider_name ^ consider_contact_no;
    }

    public boolean personOptionsSpecified() {
        return consider_id || consider_team || consider_name || consider_contact_no;
    }

}
